
  <template>
  <div class="img" :style="note">
    <div
      style="
        width: 300px;
        height: 900px;
        background-color: rgba(0, 0, 0, 0.01);
        margin: 0px auto;
        text-align: center;
        position: relative;
      "
    >
      <div
        style="
          width: 300px;
          height: 500px;
          background-color: rgba(0, 0, 0, 0.6);
          text-align: center;
          position: absolute;
          margin-top: 100px;
        "
      >
        <p
          style="
            font-size: 28px;
            font-family: '楷体';
            padding-top: 20px;
            color: slategray;
          "
        >
          没有登陆请先登陆
        </p>
        <hr style="width: 90%; height: 0.01px" />

        <div>
          <div style="margin-top: 40px" @keyup.enter="login">
            <el-input
              v-model="inputName"
              placeholder="请输入账号"
              style="width: 70%"
            ></el-input>
            <el-input
              v-model="inputPassword"
              type="password"
              placeholder="请输入密码"
              style="width: 70%; margin-top: 20px"
            ></el-input>
          </div>

          <el-button
            plain
            style="margin-top: 40px; width: 100px"
            size="small"
            @click="login"
            >登录</el-button
          >
        </div>
      </div>
    </div>
  </div>
</template>





  <script>
export default {
  data() {
    return {
      note: {
        backgroundImage: "url(" + require("../assets/img/starrr.jpg") + ")",
        backgroundRepeat: "no-repeat",
        backgroundSize: "1890px 1500px",
      },
      inputName: "",
      inputPassword: "",
    };
  },
  watch: {},
  methods: {
    login() {
      axios
        .post("http://localhost:88/provider/user/login", {
          userName: this.inputName,
          password: this.inputPassword,
        })
        .then((response) => {
          if (response.data.states == 888) {
            this.$notify({
              title: "成功",
              message: "登录成功",
              type: "success",
              duration: 2000,
            });
            this.$router.replace("/Index");
          } else {
            this.$notify.error({
              title: "错误",
              message: response.data.message,
              type: "warning",
              duration: 0,
            });
          }
        })
        .catch((response) => {
          this.$notify.error({
            title: "错误",
            message: "网络错误",
          });
        });
    },
  },
};
</script>

  <style scoped>
</style>


